<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>流程控制</title>
</head>
<body>
<script>
    function fun01(){
        //if..else流程控制
        var hour = new Date().getHours()
        if(hour<12) {
            console.log("上午好")
        }
        else if(hour<18) {
            console.log("下午好")
        }
        else {
            console.log("晚上好")
        }
    }
    fun01();
    function func02() {
        var day = new Date().getDay();
        switch (day){
            case 0:
                console.log("星期日");
                break;
            case 6:
                console.log("星期六");
                break;
        }
    }
    func02()
    //循环
    function func03() {
//        var cars = ['car1','car2','car3'];
//        var obj = {name:"wen",age:18};
//        var i = 5;
//        //数组 i 只是一个普通的变量是索引值
//        //理解下i的生存期
//        for(i in cars){
//            console.log(i, cars[i])
//        }
//        //console.log(i)
//        for(key in obj){
//            console.log(key, obj[key])
//        }
//        //while循环
//        var x = 0;
//        while (x<5){
//           console.log(x);
//           x++;
//        }

        var y = 0;
        do{
            console.log(y);
            y++;
        }while(y<5)
    }
    func03();
//    console.log(i);
</script>

</body>
</html>